package com.szpx.controller.ZRZController;

import com.szpx.entity.ZRZ.daohanglan;
import com.szpx.service.daohanglanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 1.测试前端使用Ajax向后台发送JSON数据，后台接收到数据。
 * 2.后台使用JSON解析前端传过来的数据后返回JSON数据给前端展示。
 */
@Controller
@RequestMapping("/zrz")
public class daohanglanController {
    @Autowired
    private daohanglanService daohanglanService;

    @RequestMapping("/daohanglanLayui")
    public String userHuiHuiTestLayui(HttpSession session, Model model) {
        List<daohanglan> daohanglanList = daohanglanService.selectAlldaohanglan();
        System.out.println(daohanglanList.toString());
        model.addAttribute("hi",daohanglanList);
//        D:\demo\src\main\resources\templates\lishihuiTeacherHtml\lishihuiAjaxHtml\huihui.html
        return "ZRZ/daohanglan.html";
    }


}
